{% extends "admin/import_export/base.html" %}
{% load i18n %}
{% load admin_urls %}
{% load import_export_tags %}
{% load simpletags static %}

{% block breadcrumbs_last %}
    {% trans "Export" %}
{% endblock %}

{% block extrastyle %}{{ block.super }}
    {% block css %}
        <link rel="stylesheet" href="{% static '/admin/simpleui-x/elementui/theme-chalk/index.css' %}">
    {% endblock %}
{% endblock %}

{% block content %}
    <div id="app">
        <el-page-header title="{% trans 'Back' %}" @back="goBack" content="{{ title }}"/>
    </div>
    <script type="text/javascript" src="{% static '/admin/simpleui-x/js/cookie.js' %}"></script>
    <script type="text/javascript" src="{% static 'admin/simpleui-x/js/vue.min.js' %}"></script>
    <script type="text/javascript" src="{% static '/admin/simpleui-x/elementui/index.js' %}"></script>

    <script type="text/javascript">
        function go_back() {
            window.location.href = '{% get_model_url %}';
        }

        new Vue({
            el: '#app',
            methods: {
                goBack: function () {
                    window.go_back()
                }
            }
        })
        window.addEventListener("load", () => {
            $("#id_file_format").removeAttr("required");
        });
    </script>
    <form action="" method="POST">
        {% csrf_token %}

        <fieldset class="module aligned">
            {% for field in form %}
                <div class="form-row">
                    {{ field.errors }}

                    {{ field.label_tag }}

                    {{ field }}

                    {% if field.field.help_text %}
                        <p class="help">{{ field.field.help_text|safe }}</p>
                    {% endif %}
                </div>
            {% endfor %}
        </fieldset>

        <div class="submit-row">
            <button type="button" onclick="go_back()" class="el-button el-button--button"
                    style="float: left; margin-right: 10px; margin-bottom: 10px;"><!----><i
                    class="el-icon-arrow-left"></i><span><span>返回</span></span></button>
            <input type="submit" class="el-button el-button--primary" value="{% trans "Submit" %}">
        </div>
    </form>
{% endblock %}
